package moving;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
/**
 * COPYRIGHT(C) 2008. Natasha Khuri. All Rights Reserved.
 * This class defines a Circle that can draw and move
 * @author Natasha Khuri
 * @version 1.01 2008-11-19
 */
public class Circle 
{
   
   /**
    * Constructs a Circle object
    * @param anX upper left x coordinate
    * @param anY upper left y coordinate
    * @param aDiameter circle's diameter
    */
   public Circle(int anX, int anY, int aDiameter)
   {
     x = anX;
     y = anY;
     diameter = aDiameter;
   }

   /**
    * Method to create a new Ellipse2D.Double object and
    * draw it on the canvas using g2 object
    * @param g2 Graphics2D object
    */
   public void draw(Graphics2D g2)
   {
      Ellipse2D.Double circle = new Ellipse2D.Double(x, y, diameter, diameter);
      g2.setColor(yellow);
      g2.fill(circle);
   }
   
   /**
    * Method to update the x and y coordinates of the upper-left corner
    * @param xy amount to add to the current x coordinate
    * @param yx amount to add to the current y coordinate
    */
   public void move(int xy, int yx)
   {
      x += xy;
      y += yx;
   }

   //instance fields
   private int x;
   private int y;
   private int diameter;
   public static final Color yellow = Color.YELLOW;
  
}
